<template>
<h1>猜数字练习</h1>
  <h2>已生成一个0-100的数字</h2>
  <input type="text" v-model="inputValue" placeholder="请输入数字">
  <button @click="guess">猜一猜</button>
  <div>小提示：{{result}}</div>
</template>
<script setup>

import {ref} from "vue";

const inputValue = ref('');
const num=ref(Math.floor(Math.random()*100+1));
const result=ref('');
console.log(num);
const guess = () => {
  switch (true){
    case inputValue.value>num.value:
      return result.value='猜大了';
      case inputValue.value<num.value:
        return result.value='猜小了';
      default:
        return result.value='猜对了';

  }
}
</script>


<style scoped>

</style>